<div class="Item hr">
    <div class="current">留言列表</div>
    <div class="fr"><a href="{:U('Models/show', array('id' => 13))}" class="btn">自定义字段</a></div>
</div>
<form>
    <table width="100%" border="0" cellspacing="0" cellpadding="0" class="tab">
        <thead>
            <tr>
                <td>编号</td>
                <td>留言标题</td>
                <td>留言时间</td>
                <td>是否回复</td>
                <td>审核状态</td>
                <td>操作</td>
            </tr>
        </thead>
        <tbody>
            <volist name="list" id="message" empty="$empty">
            <tr align="center">
                <td>{$message.id}</td>
                <td>{$message.title}</td>
                <td>{$message.subtime|timeToStr}</td>
                <td>{$message['reply_status'] == 0 ? '未回复' : '已回复'}</td>
                <td>{$message['status'] == 0 ? '未审核' : '已审核'}</td>
                <td> 
                <a href="{:U('view', array('id' => $message['id']))}" class="icon icon-black icon-comment-text" title="回复"></a> <a href="javascript:;" class="deleted icon icon-black icon-trash " data-url="{:U('delete')}" data-id="{$message.id}" title="删除"></a>
                </td>
            </tr>
            </volist>
        </tbody>
    </table>
</form>

<div class="page">
    {$page}
</div>
<script type="text/javascript">
$(function(){
    $(".deleted").click(function(){
        var url = $(this).data("url");
        var id = $(this).data("id");

        popup.confirm("您确定删除？", '温馨提示',function(action){
            if(action == 'ok'){
                $.ajax({
					'url' : url,
					'dataType' : 'JSON',
					'type' : 'POST',
					'data' : {'id' : id},
					'success' : function(json){
						if (json.status) {
							popup.success(json.info, "删除成功", function(){
								if(json.url){
									window.location.href = json.url;
								}else{
									top.window.location.reload();
								}
							});
						} else {
							popup.error(json.info);
							setTimeout(function(){
								popup.close("asyncbox_error");
							},2000);
						}
					}
				});
            }
        });

        return false;
    });
});
</script>
